﻿using sql_data_generator.FieldOptions;
using System;

namespace sql_data_generator.Randomizers
{
    static class RandomizerFactory
    {
        /*
        public static IRandomizer GetRandomizer<T>(T fieldOptions) where T : IFieldOptions
        {
            string typeName = fieldOptions.GetType().FullName.Replace("FieldOptions.FieldOptions", "Randomizers.Randomizer");
            var type = Type.GetType(typeName);

            return type != null ? (IRandomizer)Activator.CreateInstance(type, new object[] { fieldOptions }) : null;
        }*/

        public static IRandomizer GetRandomizer(BaseFieldOptions fieldOptions)
        {
            string typeName = fieldOptions.GetType().FullName.Replace("FieldOptions.FieldOptions", "Randomizers.Randomizer");
            var type = Type.GetType(typeName);

            return type != null ? (IRandomizer)Activator.CreateInstance(type, new object[] { fieldOptions }) : null;
        }
    }
}